using ApprovalTests;
using ApprovalTests.WinForms;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace SmallBasicFun.Tests
{
	[TestClass]
	
	public class MessageBoxTest
	{
		[TestMethod]
		public void TestSimpleInput()
		{
			var box = new MessageInput("I ain't tellin");
			WinFormsApprovals.Verify(box);
		}

		[TestMethod]
		public void ProgramWindowIsNotInvoked()
		{
			if (WindowManager.AllWindows.Count > 0) {
				return; // Needs to run before Program Window is Loaded into memory 
			}

			string response = MessageBox.AskForInput("Test Input", (MessageInput m) => m.SubmitAnswer("a"));
			Assert.AreEqual("a", response);
			Assert.AreEqual(0, WindowManager.AllWindows.Count);
		}

		[TestMethod]
		public void ProgramWindowIsParent()
		{
			Tortoise.Move(50);
			string response = MessageBox.AskForInput("Test Input", (MessageInput m) => m.SubmitAnswer("a"));
			Assert.AreEqual("a", response);
			Assert.AreEqual(1, WindowManager.AllWindows.Count);
			ApprovalHelper.ResetGraphics();
		}
	}
}